﻿using Windows.UI.Text;

namespace XamlInspector.Model.Resources
{
    public class XamlFontWeightResource : XamlResource
    {
        public XamlFontWeightResource(string key, FontWeight fontWeight, ResourceScope scope)
            : base(key, fontWeight, scope)
        {
            FontWeight = fontWeight;
            FontWeightText = GetFontWeightText(fontWeight);
        }

        public FontWeight FontWeight { get; private set; }
        public string FontWeightText { get; private set; }

        private static string GetFontWeightText(FontWeight fontWeight)
        {
            if (fontWeight.Weight == FontWeights.Black.Weight)
            {
                return "Black";
            }

            if (fontWeight.Weight == FontWeights.Bold.Weight)
            {
                return "Bold";
            }

            if (fontWeight.Weight == FontWeights.ExtraBlack.Weight)
            {
                return "ExtraBlack";
            }

            if (fontWeight.Weight == FontWeights.ExtraBold.Weight)
            {
                return "ExtraBold";
            }

            if (fontWeight.Weight == FontWeights.ExtraLight.Weight)
            {
                return "ExtraLight";
            }

            if (fontWeight.Weight == FontWeights.Light.Weight)
            {
                return "Light";
            }

            if (fontWeight.Weight == FontWeights.Medium.Weight)
            {
                return "Medium";
            }

            if (fontWeight.Weight == FontWeights.Normal.Weight)
            {
                return "Normal";
            }

            if (fontWeight.Weight == FontWeights.SemiBold.Weight)
            {
                return "SemiBold";
            }

            if (fontWeight.Weight == FontWeights.SemiLight.Weight)
            {
                return "SemiLight";
            }

            if (fontWeight.Weight == FontWeights.Thin.Weight)
            {
                return "Thin";
            }

            return string.Empty;
        }
    }
}
